
package com.fire.core.util;
import java.util.Calendar;
import java.util.Date;
import java.util.Random;
import java.util.UUID;

/**
 *类描述：单号生成类
 *@author: yangxiaotian
 *@date： 日期：2018年5月3日 时间：上午10:55:34
 *@version 1.0
 */
public class GenratorNoHelper {
    public static String generateOrderNo() {
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if (hashCodeV < 0) {
            hashCodeV = -hashCodeV;
        }
    
        return  DateTimeUtil.getCurrentTime(false) + String.format("%010d", hashCodeV);
    }

    public static String generateRequestId() {
        int hashCodeV = UUID.randomUUID().toString().hashCode();
        if (hashCodeV < 0) {
            hashCodeV = -hashCodeV;
        }
        return  DateTimeUtil.getCurrentTime(false) + String.format("%010d", hashCodeV);
    }

    public static String generateTokenNo() {
        Random random = new Random();
        return new Date().getTime() + String.format("%04d", random.nextInt(10000));
    }

    public static String generateBusinessNo() {
        Random random = new Random();
        return  DateTimeUtil.getCurrentTime(false) + String.format("%04d", random.nextInt(10000));
    }

    public static String generateUserNo(String mobile) {
        Random random = new Random();
        return Calendar.getInstance().get(Calendar.YEAR) - 2000 + mobile.substring(mobile.length() - 3) + String.format("%04d", random.nextInt(10000));
    }


}
 